main(List<String> args) {
  var list = [1, 2, 3, 'Dart', true];
  print(list);
  print(list[1]);
  list[1] = 'Hello';
  print(list);

  // ignore: unused_local_variable
  var list1 = const [1, 2, 3];
  // list1[0] = 5; // 执行报错

  // ignore: unused_local_variable
  var list2 = new List();

  // 属性
  print(list.length);

  // 方法
  // add() insert() remove() clear() indexOf() lastIndexOf() sort() sublist() shuffle() asMap() forEach()
  list.add('new');
  print(list);

  list.insert(1, 'java');
  print(list);

  list.remove('java');
  print(list);

  // list.clear();
  // print(list);

  print(list.indexOf('Dart')); // 不存在返回-1

  var list3 = ['Hello', 'Dart', 'Zeit'];
  list3.sort();
  print(list3);

  var new_list = list.sublist(2); // 不修改原数组
  print(new_list);
  print(list);

  list.forEach((element) {
    print(element);
  });

  var li = [1, 2, 3];
  print(li.asMap());
}
